import java.util.Arrays;
//https://leetcode.cn/problems/longest-increasing-subsequence/
class Solution {
    //动态规划
    int n;
    public int lengthOfLIS(int[] nums) {
        int ret = 0;
        n = nums.length;
        int[] dp = new int[n];
        Arrays.fill(dp, 1);
        for(int i = n - 1; i >= 0; i--) {
            for(int j = i + 1; j < n; j++) {
                if(nums[i] < nums[j]) {
                    dp[i] = Math.max(dp[i], dp[j] + 1);
                }
            }
            ret = Math.max(dp[i], ret);
        }
        return ret;
    }
}